import sun.plugin.WJcovUtil;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/7 15:23
 * @Copyright 博为峰
 */
public class DoWhileDemo {
    public static void main(String[] args) {
        /*
          do{
            执行语句;
          }while(条件表达式)
         */

        //1234,计算各位数字之和 1+2+3+4

        /*
          a = 1234
          a%10  4
        ------------------------
          a/10 123
          123%10 3
        ------------------------
          a/10 12
          12%10 2
       ------------------------
         */
        int a = 1234;
        int b = 0;
        int sum = 0;
        int c = 1;
        do {
            c++;
            b = a % 10;
            sum = sum + b;
            a = a / 10;
        } while (c <= 4);
        System.out.println("sum = " + sum);
    }
}
